package com.enmo.dao;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class Reflect {

	public static Class<?> getGenericSupperclass(Object obj){
		
		Class<?> clazz = obj.getClass();
		
		
		//获取父类的泛型类型
		Type type = clazz.getGenericSuperclass();
		//确定父类是泛型类型
		if(type instanceof ParameterizedType){
			ParameterizedType pt = (ParameterizedType) type;
			Type[] types = pt.getActualTypeArguments();
			return (Class<?>) types[1];
		}else{
			return Object.class;
		}
	}
}
